//77
class Solution {

    ListListInteger ret = new ArrayList();

    public ListListInteger combine(int n, int k) {
        fun(n, k, new ArrayList(), 1);
        return ret;
    }

    public void fun(int n, int k, ListInteger tmp, int i) {
        if (tmp.size() == k) {
            ListInteger list = new ArrayList();
            list.addAll(tmp);
            ret.add(list);
            return;
        }
        for (; i = n; i++) {
            tmp.add(i);
            fun(n, k, tmp, i+1);
            tmp.remove(tmp.size()-1);
        }
    }
}
猜数字游戏

import java.util.Random;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Random num = new Random();
        Scanner in = new Scanner(System.in);
        int n = 0;
        int s = num.nextInt(101);
        do{
            System.out.print("请输入你猜的数字(0~100)：");
            n = in.nextInt();
            if (n > s){
                System.out.println("猜大了");
            }else if (n < s){
                System.out.println("猜小了");
            }else{
                System.out.println("猜对了");
            }
        }while(n != s);
    }
}